import 'package:flutter/material.dart';
import 'package:flutter_widget/src/config/color_define.dart';
import 'package:flutter_widget/src/widget/text/text_format.dart';
import '../tap_widget.dart';

///文本包含数字，同一行显示
class RowText extends StatelessWidget {
  final String? text;
  final int? count;
  final VoidCallback? onTap;
  final double countSize;
  final double textSize;
  final Color countColor;
  final Color textColor;
  final FontWeight textFontWeight;
  final FontWeight countFontWeight;
  final String? countFontFamily;
  final double textPadding;
  final CrossAxisAlignment crossAxisAlignment;
  final EdgeInsetsGeometry? edPadding;

  const RowText(
    this.count,
    this.text,
    this.onTap, {
    Key? key,
    this.textSize = 11,
    this.countSize = 21,
    this.countColor = FWColorPicker.colorFF9C4C3A,
    this.textColor = FWColorPicker.colorFF666666,
    this.countFontWeight = FontWeight.bold,
    this.countFontFamily,
    this.textPadding = 3,
    this.textFontWeight = FontWeight.normal,
    this.crossAxisAlignment = CrossAxisAlignment.center,
    this.edPadding,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return TapWidget(
      onTap: onTap,
      child: Row(
        crossAxisAlignment: crossAxisAlignment,
        children: [
          TextFormatWidget(
            count == null ? "0" : count.toString(),
            textAlign: TextAlign.justify,
            fontSize: countSize,
            fontWeight: countFontWeight,
            fontName: countFontFamily,
            color: countColor,
          ),
          SizedBox(
            width: textPadding,
          ),
          Container(
            padding: edPadding ?? EdgeInsets.zero,
            child: TextFormatWidget(
              text ?? "",
              textAlign: TextAlign.justify,
              fontSize: textSize,
              color: textColor,
              fontWeight: textFontWeight,
            ),
          ),
        ],
      ),
    );
  }
}
